# -*- coding: utf-8 -*-
# @Time: 2021/10/28 21:04
# @Author: jiuwu
# @Email: 2359196586@qq.com
# @File: urls.py
# @Software: PyCharm
from django.urls import path
from .views import StudentViewSet,ClassesViewSet
from rest_framework.routers import SimpleRouter

urlpatterns = [
    # 此处要传参 get方式请求就调用list方法
    # path('students/', StudentViewSet.as_view({'get': 'list', 'put': 'create'})),
    # path('students/<pk>/', StudentViewSet.as_view({'get': 'retrieve', 'put': 'update','delete':'destroy'}))
]

router = SimpleRouter()  #创建路由器
router.register('students',StudentViewSet)  #注册路由
router.register('classes',ClassesViewSet)  #注册路由
urlpatterns += router.urls   #获取生成的路由列表并拼接